#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<cstdlib>
using namespace std;
const int N=100005;
 
int read()
{
    int ans;char ch;
    while ((ch=getchar())<'0'||ch>'9') ;ans=ch-'0';
    while ((ch=getchar())>='0'&&ch<='9') ans=ans*10+ch-'0';
    return ans; 
}
 
int n,m,k;
int head[N],tot,pre[N*6],to[N*6];
void addedge(int u,int v) {to[++tot]=v;pre[tot]=head[u];head[u]=tot;}
 
int fa[N];
int find(int u) {return u==fa[u]?u:fa[u]=find(fa[u]);}
 
int tag[N],tt;
int q1[N],h1,t1,q2[N],h2,t2,dis[N];
int work(int S,int T)
{
    q1[h1=t1=1]=S,q2[h2=t2=1]=T;
     
    ++tt;
    tag[S]=tt,tag[T]=-tt;
     
    dis[S]=dis[T]=0;
     
    for (int tmp,d=1;;d++) 
    {
        tmp=t1;
        for (int u,i=h1;i<=tmp;i++) 
        {
            u=q1[i];
            for (int v,j=head[u];j;j=pre[j]) 
            {
                v=to[j];
                if (tag[v]==tt) continue;
                if (tag[v]==-tt) return dis[u]+dis[v]+1;
                tag[v]=tt,dis[v]=dis[u]+1;
                q1[++t1]=v;
            }
        }h1=tmp+1;
         
        tmp=t2;
        for (int u,i=h2;i<=tmp;i++) 
        {
            u=q2[i];
            for (int v,j=head[u];j;j=pre[j]) 
            {
                v=to[j];
                if (tag[v]==-tt) continue;
                if (tag[v]==tt) return dis[v]+dis[u]+1;
                tag[v]=-tt,dis[v]=dis[u]+1;
                q2[++t2]=v;
            }
        }h2=tmp+1;
    }
}

int main()
{
    n=read(),m=read(),k=read();
    for (int i=1;i<=n;i++) fa[i]=i;
    for (int u,v,i=1;i<=m;i++)
    {
        u=read(),v=read();
        addedge(u,v);
        addedge(v,u);
        fa[find(u)]=find(v);
    }
    for (int u,v,i=1;i<=k;i++) 
    {
        u=read(),v=read();
        if (find(u)!=find(v)) {printf("-1\n");continue;}
        printf("%d\n",work(u,v));
    }
    return 0;
}
